home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 3_12.lha / 3_12 / 3_12tst.c < prev    next >
Text File  |  1993-08-08  |  657b  |  33 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. include <stream.h>
  6. include <string.h>
  7. include <ctype.h>
  8.  
  9. num token_value {
  10.    END = 'E', PRINT='P', NUMBER='#', NAME='N',
  11.    L1='*', L2='+', L3='(', L4=')', L5='/', L6='-', L7=':'
  12.  curr_tok;
  13.  
  14. ouble number_value;
  15. har name_string[512];
  16.  
  17. include "3_12.c"
  18.  
  19. ain()
  20.  
  21.    while (get_token() != END)
  22. {
  23. cout << "curr_tok=" << chr(curr_tok) << "\n";
  24. switch (curr_tok)
  25.     {
  26.     case NAME:    cout << "name='" << name_string << "'\n"; break;
  27.     case NUMBER:cout << "numb='" << number_value<< "'\n"; break;
  28.     }
  29. }
  30.  
  31.    return 0;
  32.  
  33.